package com.study.mike.common.utils;

import cn.hutool.core.comparator.CompareUtil;

import java.io.Serializable;

/**
 * @author KangHui
 * @Date 2022/8/8 10:35
 */
public interface MyNode<T> extends Comparable<MyNode<T>>, Serializable {
    T getId();

    MyNode<T> setId(T var1);

    T getParentId();

    MyNode<T> setParentId(T var1);

    T getChecked();

    MyNode<T> setChecked(T var1);

    CharSequence getName();

    MyNode<T> setName(CharSequence var1);

    Comparable<?> getWeight();

    MyNode<T> setWeight(Comparable<?> var1);

    @Override
    default int compareTo(MyNode node) {
        if (null == node) {
            return 1;
        } else {
            Comparable weight = this.getWeight();
            Comparable weightOther = node.getWeight();
            return CompareUtil.compare(weight, weightOther);
        }
    }
}
